﻿using System;
using TierApplication;
using System.Data;

public partial class ForeProgram_SendMail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["OrderID"] != null)
            {
                lblOrderID.Text = Request.QueryString["OrderID"].ToString();
            }
            if (Request.QueryString["AccountID"] != null)
            {
                HiddenField1.Value = Request.QueryString["AccountID"].ToString();
            }
            lblDate.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString().PadLeft(2,'0') + DateTime.Now.Date.ToString() + "日";
            //2010年8月21日
            LoadUser();
            LoadOrder();
        }
    }

    #region 加载用户信息
    /// <summary>
    /// 加载用户信息
    /// </summary>
    private void LoadUser()
    {
        T_ACCOUNT account = new T_ACCOUNT();
        DataSet ds = account.GetAccount(HiddenField1.Value);
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count != 0)
        {
            lblName.Text = ds.Tables[0].Rows[0]["ACCOUNTNAME"].ToString();
            lblEMail.Text = ds.Tables[0].Rows[0]["EMAIL"].ToString();
            lblMobile.Text = ds.Tables[0].Rows[0]["MOBILE"].ToString();
            lblSchoolName.Text = ds.Tables[0].Rows[0]["SchoolName"].ToString();
        }
        lblUrl.Text = WebPath.GetRootURI() + "/ForeProgram/Login.aspx";
        hlUrl.NavigateUrl = WebPath.GetRootURI() + "/ForeProgram/Login.aspx";
        lbl400HOTLINE.Text=account.GET_400HOTLINE();
    }
    #endregion

    #region 加载订单信息
    /// <summary>
    /// 加载订单信息
    /// </summary>
    private void LoadOrder()
    {
        T_ORDER logic = new T_ORDER();
        gvTable.DataSource=logic.GetOrderDetailList(" And ORDERID='" + lblOrderID.Text + "'").Tables[0];
        gvTable.DataBind();
        DataSet ds = logic.SP_GET_ORDERLIST(" And ORDERID='" + lblOrderID.Text + "'");
        if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
        {
            lblAmount.Text = ds.Tables[0].Rows[0]["TOTALFEE"].ToString();
            lbltotalAmount.Text = ds.Tables[0].Rows[0]["TOTALFEE"].ToString();
        }
    }

    #endregion
}